<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        ul,li{
            padding: 0;
            margin: 0;
        }
        .tab-tli li{
            padding: 10px 15px;
            text-align: center;
            list-style: none;
            cursor: pointer;
            display: inline-block;
        }
        .tab-tli>li.active{
            color: #09f;
            border-bottom: 1px solid #09f;
        }
        .tab-con div{
            margin: 30px;
        }
    </style>
</head>
<body>
    <div id="root">
        <div>
            <!-- 基本实现 -->
            <ul class="tab-tli">
                <li @click="cur=0" :class="{active:cur==0}">标题一</li>
                <li @click="cur=1" :class="{active:cur==1}">标题二</li>
                <li @click="cur=2" :class="{active:cur==2}">标题三</li>
            </ul>
            <div class="tab-con">
                <div v-show="cur==0">内容一</div>
                <div v-show="cur==1">内容二</div>
                <div v-show="cur==2">内容三</div>
            </div>

            <!-- 动态实现 -->
            <ul class="tab-tli">
                <li v-for="(v,i) in tabTitle" @click="cur=i" :class="{active:cur==i}">
                    {{v}}
                </li>
            </ul>
            <div>
                <div v-for="(v,i) in tabContent" v-show="cur===i">{{v}}</div>
            </div>
        </div>
    </div>
    <script src="https://unpkg.com/vue@2.6.11/dist/vue.js"></script>
    <script>
        window.onload=function(){
            new Vue({
                el:"#root",
                data:{
                    cur:1,
                    tabTitle:["标题一","标题二","标题三"],
                    tabContent:["内容一","内容二","内容三"]
                }
            })
        }
    </script>
</body>
</html>